package com.me.principle.inversion;

public class DependecyInversion {

	public static void main(String[] args) {
		Person person = new Person();
		person.receive(new Email());
	}

}


class Email {
	public String getInfo() {
		return "鐢靛瓙閭欢淇℃伅: hello,world";
	}
}

//瀹屾垚Person鎺ユ敹娑堟伅鐨勫姛鑳�
//鏂瑰紡1鍒嗘瀽
//1. 绠�鍗曪紝姣旇緝瀹规槗鎯冲埌
//2. 濡傛灉鎴戜滑鑾峰彇鐨勫璞℃槸 寰俊锛岀煭淇＄瓑绛夛紝鍒欐柊澧炵被锛屽悓鏃禤erons涔熻澧炲姞鐩稿簲鐨勬帴鏀舵柟娉�
//3. 瑙ｅ喅鎬濊矾锛氬紩鍏ヤ竴涓娊璞＄殑鎺ュ彛IReceiver, 琛ㄧず鎺ユ敹鑰�, 杩欐牱Person绫讳笌鎺ュ彛IReceiver鍙戠敓渚濊禆
//   鍥犱负Email, WeiXin 绛夌瓑灞炰簬鎺ユ敹鐨勮寖鍥达紝浠栦滑鍚勮嚜瀹炵幇IReceiver 鎺ュ彛灏眔k, 杩欐牱鎴戜滑灏辩鍙蜂緷璧栧�掕浆鍘熷垯
class Person {
	public void receive(Email email ) {
		System.out.println(email.getInfo());
	}
}
